/** @jsxImportSource @emotion/react */
import * as React from "react";
import {Text, useTheme,} from "customize-easy-ui-component";
import { ReportViewProps, } from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {useItemsMapPressure} from "../../common/pressure";
import {PipeLineDiagram} from "../../industrial/viewLineDg";
import {Projects默认} from "./Regular.O-1";
import {PipelineCharacteristLdisN} from "./viewFeature";
import {检验结论报告} from "./Conclusion";
import {目录页VS} from "../../movable/rarelyVary";
import {ReportFirstPageHeadNmaNmbm} from "../../contain/rarelyVary";
import {首页设备概况LdisN} from "./rarelyVary";
import {检验结论GasC} from "../viewRes";
import {AppendixPageVw} from "./AppendixPage";
import {注意事项IndPl} from "../../industrial/rarelyVary";

export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
  const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    const [rootMenu]=useRepMenuDirItems(Projects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
  return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
          <div css={{
              display: 'flex',
              flexDirection: 'column',
              justifyContent: 'space-between',
              "@media print": {height:'100vh', pageBreakInside: 'avoid',}
          }}>
                {ReportFirstPageHeadNmaNmbm({theme, rep})}
                <div>
                    <Text variant="h3" css={{textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {fontSize: theme.fontSizes[6],}
                    }}>压力管道年度检查报告<br/>
                    </Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h6" css={{textAlign: 'center',}}>（ FJB/DH 1124-2023 ）</Text>
                </div>
                <div>{首页设备概况LdisN({theme, orc, rep})}</div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
           </div>
            {注意事项IndPl({
                rep,
                comply: '书为依据《压力管道定期检验规则——长输管道》(TSG D7003—2022)制定，适用于压力管道年度检查报告的结论报告，检验结论仅代表该长输管道在检验时的安全状况'
            })}

            {目录页VS({theme, orc, rep})}
            {检验结论报告({theme, orc, rep})}
            {检验结论GasC({theme, orc, rep, bcap:'检查'})}
            <AppendixPageVw  orc={orc} rep={rep}/>

            {mapFxian.get('管道特性表')?.do &&  <PipelineCharacteristLdisN orc={orc} rep={rep} rcap='检查'/>}
            {mapFxian.get('管道单线图')?.do && <PipeLineDiagram orc={orc} rep={rep} title={'管道单线图'}/>}
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
  );
}
